//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Text;
using OpenLS.Spreadsheet.Expressions;

namespace OpenLS.Spreadsheet.Parsing
{
    class MultiSheetCellReferenceExpression: MultiSheetExpression
    {
        private readonly CellReferenceToken _token;

        public MultiSheetCellReferenceExpression(List<Worksheet> worksheets, CellReferenceToken token): base (worksheets)
        {
            Contract.Requires(token != null);
            _token = token;
        }
        public override IEnumerable<Expression> GetSubExpressions()
        {
            yield break;
        }
        internal override Expression Transposed(Cell target)
        {
            throw new NotImplementedException();
        }
         public override string GetText(TextContext context)
        {
            return WorksheetsText + "!" + _worksheets[0].Workbook.NamingConvention.GetText(_token);
        }

        public override IEnumerable<IDependencyNode> GetPrecedents(EvaluationContext context)
        {
            foreach (var worksheet in _worksheets)
            {
                yield return _token.Project(worksheet).Cell;
            }
        }

        protected internal override ICellEnumerator GetCellsValue(EvaluationContext context)
        {
            throw new NotImplementedException();
        }

        public override Expression Offset(CellRelativeAddress a)
        {
            throw new NotImplementedException();
        }
    }
}